package org.snake.exam.eg.locksupport;

import java.util.concurrent.locks.LockSupport;

public class MultiCallPark {

    public static void main(String[] args) throws InterruptedException {

        Thread worker = new Thread(() -> {

            System.out.println("执行业务逻辑...");
            System.out.println("进入状态同步点...");

            LockSupport.park();

            System.out.println("同步点完成,进步业务收尾阶段...");

            LockSupport.park();

            System.out.println("最后一个同步点结束");
        });

        worker.start();
        LockSupport.unpark(worker);
        LockSupport.unpark(worker);

        Thread.sleep(2000);

        LockSupport.unpark(worker);
    }
}
